<!DOCTYPE html>
<html>
<head>
<div th:replace="common/common_resource :: common_css"></div>
<title th:text="${application.shop_name} +' | 商品维护'"></title>
</head>
<body class="hold-transition skin-blue sidebar-mini" >
	<div class="wrapper">
		<div th:replace="common/common_h5 :: loginAndLogout"></div>
		<div th:replace="common/common_h5 :: upload_image"></div>
		<div th:replace="common/common_h5 :: left_menu"></div>
		<div class="content-wrapper">
	<section class="content">
	
	<h1 th:if="${dataBean==null || dataBean.goodsId==null}" align="center">添加商品</h1>
	<h1 th:if="${dataBean!=null && dataBean.goodsId!=null}" align="center">修改商品</h1>
	<hr/>
	<form method="post" th:action="${#httpServletRequest.getContextPath()}+'/goods/addOrUpdateGoods'" >
		<input type="hidden" name="menuUuid" value="220"/>
		<input type="hidden" name="goodsId" th:value="${dataBean!=null && dataBean.goodsId!=null}?${dataBean.goodsId}:''"/>
		<table class="table">
			<tbody>
				<tr>
					<td rowspan="2" width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsImg!=''}" height="180px" id="inputFile1Img" width="180px" th:src="@{${#strings.append(pathfile,dataBean.goodsImg)}}">
						<img th:if="${dataBean==null || dataBean.goodsImg==''}" height="180px" id="inputFile1Img" width="180px" src=" ">
						<input type="hidden" id="inputFile1Val" name="goodsImg" th:value="${dataBean!=null? dataBean.goodsImg:''}" />
					</td>
					<td class="text-left" colspan="3">
						<div class="form-group">
							<label for="goodsName">商品名称<font color="red">&nbsp;&nbsp;*</font></label>
							<input type="text" class="form-control"  th:value="${dataBean!=null? dataBean.goodsName:''}"  name="goodsName" id="goodsName" placeholder="商品名称" />
						</div>
					</td>
				</tr>
				<tr>
					<td class="text-left" colspan="3">
						<div class="form-group">
							<label for="goodsTips">促销信息/备注信息<font color="red">&nbsp;&nbsp;*</font></label>
							<textarea rows="" cols="" id="goodsTips"  th:value="${dataBean!=null? dataBean.goodsTips:''}" th:text="${dataBean!=null? dataBean.goodsTips:''}" name="goodsTips" class="form-control" placeholder="促销信息/备注信息"></textarea>
						</div>
					</td>
				</tr>
				
				<tr>
					<td class="text-center">
							<input id="inputFile1" class="inputFileClass" name="file" style="display: none" type="file"> 
							<input onclick="document.getElementById('inputFile1').click()" type="button" value="商品主图"> 
					</td>
					<td colspan="3"></td>
				</tr>
				<tr>
					
					<td colspan="4"><font size="4">添加商品细节</font><font size="4" color="red">&nbsp;&nbsp;*</font></td>
				</tr>
				<tr>
					<td>
						<div class="form-group">
							<label for="goodsNum">商品货号<font color="red">&nbsp;&nbsp;*</font></label>
							<input type="text" class="form-control" th:value="${dataBean!=null? dataBean.goodsNum:''}"  name="goodsNum" id="goodsNum" placeholder="商品货号" />
						</div>
					</td>
					<td>
						<div class="form-group">
							<label for="goodsUnit">商品单位<font color="red">&nbsp;&nbsp;*</font></label>
							<input type="text" class="form-control" name="goodsUnit"  th:value="${dataBean!=null? dataBean.goodsUnit:'束'}"  id="goodsUnit" placeholder="商品单位" />
						</div>
					</td>
					<td>
						<div class="form-group">
							<label for="goodsWeight">商品重量（以KG为单位）<font color="red">&nbsp;&nbsp;*</font></label>
							<input type="text" class="form-control" name="goodsWeight" id="goodsWeight" th:value="${dataBean!=null? dataBean.goodsWeight:'1'}"  placeholder="商品重量" />
						</div>
					</td>
					<td>
					<label for="depuuid">是否同城配送</label>
						<select	class="form-control" name="goodsIsfreight" id="goodsIsfreight">
							<option value="2"  th:selected="(${dataBean!=null? dataBean.goodsIsfreight:2} == 2)" >---同城配送---</option>
							<option value="1"  th:selected="(${dataBean!=null? dataBean.goodsIsfreight:''} == 1)" >---快递---</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label for="goodsHot">是否热卖</label>
						<select	class="form-control" name="goodsHot" id="goodsHot">
							<option value="0" th:selected="(${dataBean!=null? dataBean.goodsHot:0} == 0)">---不是---</option>
							<option value="1" th:selected="(${dataBean!=null? dataBean.goodsHot:''} == 1)">---是---</option>
						</select>
					</td>
					<td>
						<label for="goodsOriginality">是否是网红创意</label>
						<select	class="form-control" name="goodsOriginality" id="goodsOriginality">
							<option value="0" th:selected="(${dataBean!=null? dataBean.goodsOriginality:0} == 0)">---不是---</option>
							<option value="1" th:selected="(${dataBean!=null? dataBean.goodsOriginality:''} == 1)">---是---</option>
						</select>
					</td>
					<td>
						<label for="goodsIsrecom">是否店家推荐</label>
						<select	class="form-control" name="goodsIsrecom" id="goodsIsrecom">
							<option value="0" th:selected="(${dataBean!=null? dataBean.goodsIsrecom:0} == 0)">---不是---</option>
							<option value="1" th:selected="(${dataBean!=null? dataBean.goodsIsrecom:''} == 1)">---是---</option>
						</select>
					</td>
					<td>
						<label for="goodsCheck">是否是审核通过</label>
						<select	class="form-control" name="goodsCheck" id="goodsCheck">
							<option value="0" th:selected="(${dataBean!=null? dataBean.goodsCheck:0} == 0)">---不是---</option>
							<option value="1" th:selected="(${dataBean!=null? dataBean.goodsCheck:''} == 1)">---是---</option>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="4"><font size="4">添加商品相册图片</font><font size="4" color="red">&nbsp;&nbsp;*</font></td>
				</tr>
				<tr>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=1 && dataBean.goodsGallery[0]!=''}" height="150px"  id="inputFile2Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsGallery[0])}}">
						<img th:if="${dataBean==null || dataBean.goodsGallery==null || (dataBean.goodsGallery.length>=1 && dataBean.goodsGallery[0]=='') }" height="150px"  id="inputFile2Img" width="150px" src=" ">
						<input type="hidden" id="inputFile2Val" name="goodsGallery" th:value="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=1}?${dataBean.goodsGallery[0]}:''"/>
					</td>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=2 && dataBean.goodsGallery[1]!=''}" height="150px"  id="inputFile3Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsGallery[1])}}">
						<img th:if="${dataBean==null || dataBean.goodsGallery==null || (dataBean.goodsGallery.length>=2 && dataBean.goodsGallery[1]=='')}" height="150px" id="inputFile3Img" width="150px" src=" ">
						<input type="hidden" id="inputFile3Val" name="goodsGallery" th:value="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=2}?${dataBean.goodsGallery[1]}:''"/>
					</td>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=3 && dataBean.goodsGallery[2]!=''}" height="150px"  id="inputFile4Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsGallery[2])}}">
						<img th:if="${dataBean==null || dataBean.goodsGallery==null || (dataBean.goodsGallery.length>=3 && dataBean.goodsGallery[2]=='')}" height="150px" id="inputFile4Img" width="150px" src=" ">
						<input type="hidden" id="inputFile4Val" name="goodsGallery" th:value="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length>=3}?${dataBean.goodsGallery[2]}:''"/>
					</td>
					<td  width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length==4 && dataBean.goodsGallery[3]!=''}" height="150px"  id="inputFile5Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsGallery[3])}}">
						<img th:if="${dataBean==null || dataBean.goodsGallery==null || (dataBean.goodsGallery.length==4 && dataBean.goodsGallery[3]=='')}" height="150px" id="inputFile5Img" width="150px" src=" ">
						<input type="hidden" id="inputFile5Val" name="goodsGallery" th:value="${dataBean!=null && dataBean.goodsGallery!=null && dataBean.goodsGallery.length==4}?${dataBean.goodsGallery[3]}:''"/>
					</td>
				</tr>
				<tr>
					<td class="text-center">
						<input id="inputFile2" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="2" type="button" value="添加图 1"> 
					</td>
					<td class="text-center">
						<input id="inputFile3" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="3" type="button" value="添加图 2"> 
					</td>
					<td class="text-center">
						<input id="inputFile4" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="4" type="button" value="添加图 3"> 
					</td>
					<td class="text-center">
						<input id="inputFile5" class="inputFileClass"  name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="5" type="button" value="添加图 4"> 
					</td>
				</tr>
				
				<tr>
					<td colspan="4"><font size="4">添加商品详细介绍图片</font><font size="4" color="red">&nbsp;&nbsp;*</font></td>
				</tr>
				<tr>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=1 && dataBean.goodsDesc[0]!=''}" height="150px"  id="inputFile6Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsDesc[0])}}">
						<img th:if="${dataBean==null || dataBean.goodsDesc==null || (dataBean.goodsDesc.length>=1 && dataBean.goodsDesc[0]=='')}" height="150px" id="inputFile6Img" width="150px" src=" ">
						<input type="hidden" id="inputFile6Val" name="goodsDesc" th:value="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=1}?${dataBean.goodsDesc[0]}:''"/>
					</td>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=2 && dataBean.goodsDesc[1]!=''}" height="150px"  id="inputFile7Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsDesc[1])}}">
						<img th:if="${dataBean==null || dataBean.goodsDesc==null || (dataBean.goodsDesc.length>=2 && dataBean.goodsDesc[1]=='')}" height="150px" id="inputFile7Img" width="150px" src=" ">
						<input type="hidden" id="inputFile7Val" name="goodsDesc" th:value="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=2}?${dataBean.goodsDesc[1]}:''"/>
					</td>
					<td width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=3 && dataBean.goodsDesc[2]!=''}" height="150px"  id="inputFile8Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsDesc[2])}}">
						<img th:if="${dataBean==null || dataBean.goodsDesc==null ||(dataBean.goodsDesc.length>=3 && dataBean.goodsDesc[2]=='')}" height="150px" id="inputFile8Img" width="150px" src=" ">
						<input type="hidden" id="inputFile8Val" name="goodsDesc" th:value="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length>=3}?${dataBean.goodsDesc[2]}:''"/>
					</td>
					<td  width="25%" class="text-center">
						<img th:if="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length==4 && dataBean.goodsDesc[3]!=''}" height="150px"  id="inputFile9Img" width="150px" th:src="@{${#strings.append(pathfile,dataBean.goodsDesc[3])}}">
						<img th:if="${dataBean==null || dataBean.goodsDesc==null || (dataBean.goodsDesc.length==4 && dataBean.goodsDesc[3]=='')}" height="150px" id="inputFile9Img" width="150px" src=" ">
						<input type="hidden" id="inputFile9Val" name="goodsDesc" th:value="${dataBean!=null && dataBean.goodsDesc!=null && dataBean.goodsDesc.length==4}?${dataBean.goodsDesc[3]}:''"/>
					</td>
				</tr>
				
				<tr>
					<td class="text-center">
						<input id="inputFile6" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="6" type="button" value="详细图片1"> 
					</td>
					<td class="text-center">
						<input id="inputFile7" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="7" type="button" value="详细图片2"> 
					</td>
					<td class="text-center">
						<input id="inputFile8" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="8" type="button" value="详细图片 3"> 
					</td>
					<td class="text-center">
						<input id="inputFile9" class="inputFileClass" name="file" style="display: none" type="file"> 
						<input class="inputFileButton" id="9" type="button" value="详细图片4"> 
					</td>
				</tr>
			</tbody>
		</table>
    	<h4>添加商品规格<font color="red">&nbsp;&nbsp;*</font></h4>	
	    <table class="table table-bordered table-striped ">
			<thead>
				<tr class="bg-green ">
					<th>规格图片</th>
					<th>添加规格图片</th>
					<th>商品规格名称</th>
					<th>门店价（￥）</th>
					<th>市场价（￥）</th>
					<th>库存</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr th:if="${dataBean!=null && dataBean.goodskuList!=null}" th:each="goodsku,goodskuStat : ${dataBean!=null && dataBean.goodskuList!=null}?${dataBean.goodskuList}:''">
					<td>
						<img height="50px" th:id="inputFile+${goodskuStat.index+10}+Img" width="50px" th:src="@{${#strings.append(pathfile,goodsku.skuImg)}}">
						<input type="hidden" th:id="inputFile+${goodskuStat.index+10}+Val" name="skuImg" th:value="${goodsku.skuImg}"/>
					</td>
					<td>
						<input th:id="inputFile+${goodskuStat.index+10}" name="file" class="inputFileClass" style="display: none" type="file"> 
						<input class="inputFileButton" th:id="${goodskuStat.index+10}" type="button" value="添加规格图片"> 
					</td>
					<td>
						<input type="text" class="form-control" th:value="${goodsku.goodsSkuName}" name="goodsSkuName" id="goodsSkuName" placeholder="商品规格名称" />
					</td>
					<td>
						<input type="NUMBER" class="form-control" th:value="${goodsku.goodsSkuDisct}" max="9999999999999" name="goodsSkuDisct" id="goodsSkuDisct" placeholder="门店价" />
					</td>
					<td>
						<input type="NUMBER" class="form-control" max="9999999999999" th:value="${goodsku.goodsSkuPrice}" name="goodsSkuPrice" id="goodsSkuPrice" placeholder="市场价" />
					</td>
					<td>
						<input type="NUMBER" class="form-control"  name="goodsSkuStock" id="goodsSkuStock" th:value="${goodsku.goodsSkuStock}"  placeholder="库存" />
					</td>
					<td>
						<a th:if="${goodskuStat.index==0}" href="javascript:void(0);" class="btn btn-block btn-success add_goodsSku" th:id="${goodskuStat.size+10}">添加规格</a>
						<a th:if="${goodskuStat.index>0}" class="btn btn-block btn-danger delete_goodsSku" href="javascript:void(0);">删除</a>
					</td>
				</tr>
				
				<tr th:if="${dataBean==null}">
					<td>
						<input name="skuId" type="hidden" value=""/>
						<img height="50px" id="inputFile10Img" width="50px" src=" ">
						<input type="hidden" id="inputFile10Val" name="skuImg"/>
					</td>
					<td>
						<input id="inputFile10" name="file" class="inputFileClass" style="display: none" type="file"> 
						<input class="inputFileButton" id="10" type="button" value="添加规格图片"> 
					</td>
					<td>
						<input type="text" class="form-control" name="goodsSkuName" id="goodsSkuName" placeholder="商品规格名称" />
					</td>
					<td>
						<input type="NUMBER" class="form-control" max="9999999999999" name="goodsSkuDisct" id="goodsSkuDisct" placeholder="门店价" />
					</td>
					<td>
						<input type="NUMBER" class="form-control" max="9999999999999" name="goodsSkuPrice" id="goodsSkuPrice" placeholder="市场价" />
					</td>
					<td>
						<input type="NUMBER" class="form-control"  name="goodsSkuStock" id="goodsSkuStock" placeholder="库存" />
					</td>
					<td>
						<a href="javascript:void(0);" class="btn btn-block btn-success add_goodsSku" id="10">添加规格</a>
					</td>
				</tr>
				
			</tbody>
		</table>
    	<hr>
	    <div class="row">
			<div class="col-xs-6 text-center"></div>
	    	<div class="col-xs-3 text-right">
	    		<button type="reset" class="btn btn-block btn-warning" data-dismiss="modal" id="clearall">清&nbsp;&nbsp;&nbsp;&nbsp;空</button>
	    	</div>
	     	<div class="col-xs-3 text-right">
	     		<button type="submit" class="btn btn-block btn-info">提&nbsp;&nbsp;&nbsp;&nbsp;交</button>
	     	</div>
		</div>
	</form>
	<input type="hidden" id="fileAction" th:value="${#httpServletRequest.getContextPath()}+'/file/uploadGoodsImg'">
	</section>
		</div>
		<div th:replace="common/common_h5 :: down_foot"></div>
		<div th:replace="common/common_h5 :: down_sidebar"></div>
		<div th:replace="common/common_h5 :: error_message"></div>
		<div class="control-sidebar-bg"></div>
		<div th:replace="common/common_resource :: common_js"></div>
		<script th:src="@{/admin_js/basics/process/goods_list.js}"></script>
</body>
</html>
